- 显示所有评论{% for foo in ques.comments %}
- { { foo.author.username }} { { foo.creat_time }}
{
{ foo.detail }} {% endfor %}
Comment[{
{ question.comments|length }}]{% for foo in question.comments %} - { { foo.author.username }} { { foo.creat_time }}
- 所有评论排序uquestion = db.relationship('Question', backref=db.backref('comments', order_by=creat_time.desc))
question = db.relationship('Question', backref=db.backref('comments',order_by=creat_time.desc))
- 显示评论条数{ { ques.comments|length }}
Comment[{
{ question.comments|length }}] - 完成个人中心
{% extends 'base.html' %}{% block title %}Center{% endblock %}{% block head %} {% endblock %}{% block main %}{% endblock %}{ { user.username }}
All Questions And Answers
{% for foo in user.question %}- { { foo.author.username }} { { foo.creat_time }} { { foo.title }}
{% endfor %}{
{ foo.detail }}
ALL Comments
{% for foo in user.comments %}- { { foo.author.username }} { { foo.creat_time }}
{% endfor %}{
{ foo.detail }}
Personal Information
Username:{
{ user.username }}Id:{
{ user.id }}Number of articles:{
{ user.question|length }}
1.个人中心的页面布局(html文件及相应的样式文件)
2.定义视图函数def usercenter(user_id):
3.向前端页面传递参数
4.页面显示相应数据
发布的全部问答
发布的全部评论
个人信息
5.各个页面链接到个人中心